Switch to generated CollectionRef
authorFelix Krull <f_krull@gmx.de>
Tue, 21 May 2019 17:38:30 +0000 (19:38 +0200)
committerColin Walters <walters@verbum.org>
Fri, 6 May 2022 16:53:53 +0000 (12:53 -0400)
12 files changed:
rust-bindings/rust/Makefile
rust-bindings/rust/conf/ostree.toml
rust-bindings/rust/src/auto/collection_ref.rs [new file with mode: 0644]
rust-bindings/rust/src/auto/deployment.rs
rust-bindings/rust/src/auto/mod.rs
rust-bindings/rust/src/auto/repo.rs
rust-bindings/rust/src/auto/se_policy.rs
rust-bindings/rust/src/auto/sysroot.rs
rust-bindings/rust/src/auto/sysroot_upgrader.rs
rust-bindings/rust/src/auto/versions.txt
rust-bindings/rust/src/collection_ref.rs [deleted file]
rust-bindings/rust/src/lib.rs

index 1bf5acda3f20aade9adb857b061d60f56674da2e..5108e84ba98b20b97143d700f1c8bb23e3fcdcce 100644 (file)
@@ -5,7 +5,8 @@ all: gir/ostree gir/ostree-sys
 
 # -- gir generation --
 target/tools/bin/gir:
-       cargo install --root target/tools --git https://github.com/gtk-rs/gir.git --rev fec179c697a03e4aa98c610f7b98fd1b0ceb9344 -- gir
+       #cargo install --root target/tools --git https://github.com/gtk-rs/gir.git --rev fec179c697a03e4aa98c610f7b98fd1b0ceb9344 -- gir
+       cargo install --root target/tools --git https://github.com/fkrull/gir.git --branch fixup-gconstpointer -- gir
 
 gir/%: target/tools/bin/gir
        target/tools/bin/gir -c conf/$*.toml
index 514f4870a0aa3b75235aa4ae559178579c1f1078..f8636fe0834b4d738751962dcaf1bce4295fec9c 100644 (file)
@@ -66,8 +66,7 @@ os_tree = "ostree"
 
 [[object]]
 name = "OSTree.CollectionRef"
-status = "manual"
-    # for reference: the settings used to generate the hand-tuned implementation
+status = "generate"
     [[object.function]]
     # helper functions for NULL-terminated arrays
     pattern = "dupv|freev"
diff --git a/rust-bindings/rust/src/auto/collection_ref.rs b/rust-bindings/rust/src/auto/collection_ref.rs
new file mode 100644 (file)
index 0000000..b3c4c43
--- /dev/null
@@ -0,0 +1,60 @@
+// This file was generated by gir (https://github.com/gtk-rs/gir)
+// from gir-files (https://github.com/gtk-rs/gir-files)
+// DO NOT EDIT
+
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+use glib::translate::*;
+use glib_sys;
+use gobject_sys;
+use ostree_sys;
+use std::hash;
+
+glib_wrapper! {
+    #[derive(Debug, PartialOrd, Ord)]
+    pub struct CollectionRef(Boxed<ostree_sys::OstreeCollectionRef>);
+
+    match fn {
+        copy => |ptr| gobject_sys::g_boxed_copy(ostree_sys::ostree_collection_ref_get_type(), ptr as *mut _) as *mut ostree_sys::OstreeCollectionRef,
+        free => |ptr| gobject_sys::g_boxed_free(ostree_sys::ostree_collection_ref_get_type(), ptr as *mut _),
+        get_type => || ostree_sys::ostree_collection_ref_get_type(),
+    }
+}
+
+impl CollectionRef {
+    #[cfg(any(feature = "v2018_6", feature = "dox"))]
+    pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option<CollectionRef> {
+        unsafe {
+            from_glib_full(ostree_sys::ostree_collection_ref_new(collection_id.to_glib_none().0, ref_name.to_glib_none().0))
+        }
+    }
+
+    #[cfg(any(feature = "v2018_6", feature = "dox"))]
+    fn equal(&self, ref2: &CollectionRef) -> bool {
+        unsafe {
+            from_glib(ostree_sys::ostree_collection_ref_equal(ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(self).0 as glib_sys::gconstpointer, ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(ref2).0 as glib_sys::gconstpointer))
+        }
+    }
+
+    #[cfg(any(feature = "v2018_6", feature = "dox"))]
+    fn hash(&self) -> u32 {
+        unsafe {
+            ostree_sys::ostree_collection_ref_hash(ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(self).0 as glib_sys::gconstpointer)
+        }
+    }
+}
+
+impl PartialEq for CollectionRef {
+    #[inline]
+    fn eq(&self, other: &Self) -> bool {
+        self.equal(other)
+    }
+}
+
+impl Eq for CollectionRef {}
+
+impl hash::Hash for CollectionRef {
+    #[inline]
+    fn hash<H>(&self, state: &mut H) where H: hash::Hasher {
+        hash::Hash::hash(&self.hash(), state)
+    }
+}
index e2ed855a94c59b763890eaa4b8faee7c12fcdb18..a8b4a7e33ca5fd9205f32ea5c964caff972eb3a4 100644 (file)
@@ -35,7 +35,7 @@ impl Deployment {
 
     pub fn equal(&self, bp: &Deployment) -> bool {
         unsafe {
-            from_glib(ostree_sys::ostree_deployment_equal(ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer, ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(bp).0 as glib_sys::gconstpointer))
+            from_glib(ostree_sys::ostree_deployment_equal(ToGlibPtr::<*const ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer, ToGlibPtr::<*const ostree_sys::OstreeDeployment>::to_glib_none(bp).0 as glib_sys::gconstpointer))
         }
     }
 
@@ -140,7 +140,7 @@ impl Deployment {
 
     pub fn hash(&self) -> u32 {
         unsafe {
-            ostree_sys::ostree_deployment_hash(ToGlibPtr::<*mut ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer)
+            ostree_sys::ostree_deployment_hash(ToGlibPtr::<*const ostree_sys::OstreeDeployment>::to_glib_none(self).0 as glib_sys::gconstpointer)
         }
     }
 
index 9afc9d784edf140d08f46372fecd6844618a5514..5db35766beab678b47f81810f35282838c702dfe 100644 (file)
@@ -35,6 +35,11 @@ pub use self::sysroot::{Sysroot, SysrootClass};
 mod sysroot_upgrader;
 pub use self::sysroot_upgrader::{SysrootUpgrader, SysrootUpgraderClass};
 
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+mod collection_ref;
+#[cfg(any(feature = "v2018_6", feature = "dox"))]
+pub use self::collection_ref::CollectionRef;
+
 #[cfg(any(feature = "v2018_6", feature = "dox"))]
 mod remote;
 #[cfg(any(feature = "v2018_6", feature = "dox"))]
index 5753124389f8b713722adddd2c7c6aa0a8f0c531..dfe9f3e485e7536b618f5c767365df31533ece1a 100644 (file)
@@ -31,7 +31,7 @@ use glib::GString;
 use glib::StaticType;
 use glib::Value;
 use glib::object::IsA;
-use glib::object::ObjectType as _;
+use glib::object::ObjectType as ObjectType_;
 use glib::signal::SignalHandlerId;
 use glib::signal::connect_raw;
 use glib::translate::*;
index f52c953563482c7fdc974c2d02fbf217f0de723c..c930c5dbe52144c48d198185610bd1cb6e774c1e 100644 (file)
@@ -9,7 +9,7 @@ use glib::GString;
 use glib::StaticType;
 use glib::Value;
 use glib::object::IsA;
-use glib::object::ObjectType as _;
+use glib::object::ObjectType as ObjectType_;
 use glib::translate::*;
 use gobject_sys;
 use ostree_sys;
index 60eae2198728f0bba5c10f581d9ee453b50d1751..aee88eb714f014a28b3bd3711476cad1deff099d 100644 (file)
@@ -16,7 +16,7 @@ use glib;
 use glib::GString;
 use glib::object::IsA;
 #[cfg(any(feature = "v2017_10", feature = "dox"))]
-use glib::object::ObjectType as _;
+use glib::object::ObjectType as ObjectType_;
 #[cfg(any(feature = "v2017_10", feature = "dox"))]
 use glib::signal::SignalHandlerId;
 #[cfg(any(feature = "v2017_10", feature = "dox"))]
index 4e51db9c3f2442eec3c1599d8bd69ecbbfe16b89..4b95e1e9a9a4baf830a93d02feaad54783dde9b8 100644 (file)
@@ -15,7 +15,7 @@ use glib::GString;
 use glib::StaticType;
 use glib::Value;
 use glib::object::IsA;
-use glib::object::ObjectType as _;
+use glib::object::ObjectType as ObjectType_;
 use glib::translate::*;
 use gobject_sys;
 use ostree_sys;
index be52760aa761910c2cdaa573bac8b4f9fa444443..f51e58a2ee7ee35cc76df4ce8d888aed03607ab8 100644 (file)
@@ -1,2 +1,2 @@
-Generated by gir (https://github.com/gtk-rs/gir @ fec179c)
+Generated by gir (https://github.com/gtk-rs/gir @ 1bff597)
 from gir-files (https://github.com/gtk-rs/gir-files @ ???)
diff --git a/rust-bindings/rust/src/collection_ref.rs b/rust-bindings/rust/src/collection_ref.rs
deleted file mode 100644 (file)
index c99542e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// Based on a file generated by gir. Changes are marked below.
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-use glib::translate::*;
-use glib_sys;
-use gobject_sys;
-use ostree_sys;
-use std::hash;
-
-glib_wrapper! {
-    #[derive(Debug, PartialOrd, Ord)]
-    pub struct CollectionRef(Boxed<ostree_sys::OstreeCollectionRef>);
-
-    match fn {
-        copy => |ptr| gobject_sys::g_boxed_copy(ostree_sys::ostree_collection_ref_get_type(), ptr as *mut _) as *mut ostree_sys::OstreeCollectionRef,
-        free => |ptr| gobject_sys::g_boxed_free(ostree_sys::ostree_collection_ref_get_type(), ptr as *mut _),
-        get_type => || ostree_sys::ostree_collection_ref_get_type(),
-    }
-}
-
-impl CollectionRef {
-    #[cfg(any(feature = "v2018_6", feature = "dox"))]
-    pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option<CollectionRef> {
-        unsafe {
-            from_glib_full(ostree_sys::ostree_collection_ref_new(
-                collection_id.to_glib_none().0,
-                ref_name.to_glib_none().0,
-            ))
-        }
-    }
-
-    #[cfg(any(feature = "v2018_6", feature = "dox"))]
-    fn equal(&self, ref2: &CollectionRef) -> bool {
-        unsafe {
-            // CHANGE: both instances of *mut to *const
-            from_glib(ostree_sys::ostree_collection_ref_equal(
-                ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(self).0
-                    as glib_sys::gconstpointer,
-                ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(ref2).0
-                    as glib_sys::gconstpointer,
-            ))
-        }
-    }
-
-    #[cfg(any(feature = "v2018_6", feature = "dox"))]
-    fn hash(&self) -> u32 {
-        unsafe {
-            // CHANGE: *mut to *const
-            ostree_sys::ostree_collection_ref_hash(
-                ToGlibPtr::<*const ostree_sys::OstreeCollectionRef>::to_glib_none(self).0
-                    as glib_sys::gconstpointer,
-            )
-        }
-    }
-}
-
-impl PartialEq for CollectionRef {
-    #[inline]
-    fn eq(&self, other: &Self) -> bool {
-        self.equal(other)
-    }
-}
-
-impl Eq for CollectionRef {}
-
-impl hash::Hash for CollectionRef {
-    #[inline]
-    fn hash<H>(&self, state: &mut H)
-    where
-        H: hash::Hasher,
-    {
-        hash::Hash::hash(&self.hash(), state)
-    }
-}
index 5ac6af24d649252ae3c5515fc2bbf5b189c38d23..b69a70182e1d0288eb821ebd44ea20202895e215 100644 (file)
@@ -19,12 +19,8 @@ pub use crate::auto::functions::*;
 pub use crate::auto::*;
 
 // handwritten code
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-mod collection_ref;
-mod repo;
-#[cfg(any(feature = "v2018_6", feature = "dox"))]
-pub use crate::collection_ref::*;
 mod object_name;
+mod repo;
 pub use crate::object_name::*;
 
 // tests